var to = document.querySelector('.to');
var bo = document.querySelector('.bo');
var table1 = document.querySelector('.logon');
var table2 = document.querySelector('.register');
var sanjiao = document.querySelector('.sanjiao');
var flag1=0;
var flag2=0;
var flag3=0;
// var eye_input1 = document.getElementsByClassName('pa1');
// console.log(eye_input1);
// console.log(eye_input1.getElementsByTagName('input'));
// console.log(eye_input1.getElementsByTagName('img') );
// var eye_input2 = document.querySelector('.pa2');
// var eye_input3 = document.querySelector('.pa3');
// var flag=0;
var box1 = document.getElementById('pa1');
var input1 = box1.getElementsByTagName('input')[0];
var img1 = box1.getElementsByTagName('img')[0];

var box2 = document.getElementById('pa2');
var input2 = box2.getElementsByTagName('input')[0];
var img2 = box2.getElementsByTagName('img')[0];

var box3 = document.getElementById('pa3');
var input3 = box3.getElementsByTagName('input')[0];
var img3 = box3.getElementsByTagName('img')[0];
console.log(img1);
to.onclick = function(){
    table1.style.display = 'block';
    table2.style.display = 'none';
    to.style.backgroundColor = 'rgb(235, 215, 130)';
    bo.style.backgroundColor = '#fff';
    sanjiao.style.top = 0;
}
bo.onclick = function(){
    table1.style.display = 'none';
    table2.style.display = 'block';
    to.style.backgroundColor = '#fff';
    bo.style.backgroundColor = 'rgb(235, 215, 130)';
    sanjiao.style.top = '250px';
}
//eye_input1.querySelector('img').addEventListener('click',fun3);
//eye_input2.querySelector('img').addEventListener('click',fun3);
//eye_input3.querySelector('img').addEventListener('click',fun3);
 
img1.onclick = function(){
    if(flag1==0){
        // console.log(eye_input1.children[1]);
        img1.src = "../img/zhengyan.png";
        // console.log(eye_input1.children[0]);
        input1.type = "text";
        flag1 = 1;
    }
    else{
        img1.src = '../img/biyan.png';
        input1.type = 'password';
        flag1 = 0;
    }
};

img2.onclick = function(){
    if(flag2==0){
        // console.log(eye_input1.children[1]);
        img2.src = "../img/zhengyan.png";
        // console.log(eye_input1.children[0]);
        input2.type = "text";
        flag2 = 1;
    }
    else{
        img2.src = '../img/biyan.png';
        input2.type = 'password';
        flag2 = 0;
    }
};

img3.onclick = function(){
    if(flag3==0){
        // console.log(eye_input1.children[1]);
        img3.src = "../img/zhengyan.png";
        // console.log(eye_input1.children[0]);
        input3.type = "text";
        flag3 = 1;
    }
    else{
        img3.src = '../img/biyan.png';
        input3.type = 'password';
        flag3 = 0;
    }
};
